Numerical Solution of Ordinary Differential Equations:

Single-step methods

The (Forward) Euler method

Given the initial value problem $$y'(t)=f(x,y(x)),\qquad y(x_{0})=y_{0},$$ the (forward) Euler method is defiend as follows $$y_{n+1}=y_{n}+hf(x_{n},y_{n}).$$

Example Conisder the initial value problem $\begin{cases}y'+2xy=xe^{-x^2},\\ y(0) = 1 \end{cases},\quad 0 \leq x \leq 1$ with exact solution $y\left(x \right) = \left(1 + \dfrac{x^{2}}{2}\right) e^{- x^{2}}$, use the forward Euler to approximate the solution of the IVP.

The Backward (Implicit) Euler method

Given the initial value problem $$y'(t)=f(x,y(x)),\qquad y(x_{0})=y_{0},$$ the backward (implicit) Euler method is defiend as follows $$y_{n+1}=y_{n}+hf(x_{n+1},y_{n+1}).$$

The improved Euler method

Given the initial value problem $$y'(t)=f(x,y(x)),\qquad y(x_{0})=y_{0},$$ the (Forward) Euler method is defiend as follows $$y_{n+1}=y_{n}+hf(x_{n},y_{n}).$$

The improved (semi-implicit) Euler method can be also is defiend as follows \begin{align} \begin{cases} z_{n}=y_{n}+hf(x_{n},y_{n})\\ y_{n+1}=y_{n}+\dfrac{h}{2}\left(f(x_{n},y_{n})+f(x_{n+1},z_{n}) \right) \end{cases} \end{align}

Example: Try the previous Example, using the semi-implicit Euler method.

The Explicit Midpoint method

Given the initial value problem $$y'(t)=f(x,y(x)),\qquad y(x_{0})=y_{0},$$ The explicit midpoint method is given by the formula $$y_{n+1}=y_{n}+hf\left(x_{n}+{\frac {h}{2}},y_{n}+{\frac {h}{2}}f(x_{n},y_{n})\right).$$

The Implicit Midpoint method

Given the initial value problem $$y'(t)=f(x,y(x)),\qquad y(x_{0})=y_{0},$$ the implicit midpoint method is given by $$y_{n+1}=y_{n}+hf\left(t_{n}+{\frac {h}{2}},{\frac {1}{2}}(y_{n}+y_{n+1})\right).$$

Trapezoidal rule

Given the initial value problem $$y'(t)=f(x,y(x)),\qquad y(x_{0})=y_{0},$$ the trapezoidal rule is given by $$y_{{n+1}}=y_{n}+{\dfrac 12}h{\Big (}f(x_{n},y_{n})+f(x_{{n+1}},y_{{n+1}}){\Big )}.$$

Heun's method

Given the initial value problem $$y'(t)=f(x,y(x)),\qquad y(x_{0})=y_{0},$$ the Heun's method is given by $$ y_{n+1}=y_{n}+{\dfrac {h}{4}}\left(f(x_{n},y_{n})+f(x_{n}+\dfrac{2}{3}h,y_{n}+\dfrac{2}{3}f(x_n,y_n))\right). $$

Multi-step Methods

The Runge–Kutta method

It is defiend as follows

$y_{n+1}=y_{n}+{\dfrac {1}{6}}\left(k_{1}+2k_{2}+2k_{3}+k_{4}\right),\quad \text{for }n = 0, 1, 2, 3, \ldots,$ with \begin{align} \begin{cases} k_{1}&=h\ f(t_{n},y_{n}),\\k_{2}&=h\ f\left(t_{n}+{\frac {h}{2}},y_{n}+{\frac {k_{1}}{2}}\right),\\k_{3}&=h\ f\left(t_{n}+{\frac {h}{2}},y_{n}+{\frac {k_{2}}{2}}\right),\\k_{4}&=h\ f\left(t_{n}+h,y_{n}+k_{3}\right). \end{cases} \end{align}

Adams methods

\begin{align} z_{n+1}&=y_{n}+\dfrac{h}{2}\left(3f(x_{n},y_{n})-f(x_{n-1},y_{n-1})\right),\\ y_{n+1}&=y_{n}+\dfrac{h}{2} \left(f(x_{n+1},z_{n+1})+f(x_{n},y_{n})\right). \end{align}

The four-step Adams predictor-corrector method uses the four-step Adams–Bashforth and Adams-Moulton methods together:

\begin{align} z_{n+1}&=y_{n}+\dfrac{h}{24} \left(55f(x_{n},y_{n})-59f(x_{n-1},y_{n-1})+37f(x_{n-2},y_{n-2})-9f(x_{n-3},y_{n-3})\right),\\ y_{n+1}&=y_{n}+\dfrac{h}{24} \left(9f(x_{n+1},z_{n+1})+19f(x_{n},y_{n})-5f(x_{n-1},y_{n-1})+f(x_{n-2},y_{n-2})\right). \end{align}

Taylor’s methods

Taylor's Method of order $n$:

\begin{align*} y(x_{i+1}) = y(x_{i})& + h f(x_{i},y(x_{i})) + \frac{h^{2}}{2} f'(x_{i},y(x_{i})) + \ldots + \frac{h^{n}}{n!}f^{(n-1)}(x_{i},y(x_{i})) \end{align*}